//
//  LzwBaseTableViewCell.m
//  HalfsugarAPP
//
//  Created by 刘志武 on 15/12/28.
//  Copyright © 2015年 刘志武. All rights reserved.
//

#import "LzwBaseTableViewCell.h"

@implementation LzwBaseTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
        NSString *states = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
        
        if ([states isEqualToString:@"yes"]) {
            //黑夜状态
            self.backgroundColor = [UIColor blackColor];
        }
        
        
    }
    return self;
}

- (void)changeColor:(NSNotification *)notifi{
    
    UIColor *color = [notifi object];
    self.backgroundColor = color;
    
}

@end
